package com.springbootmybatiscurd.utils;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class PhotoUtils implements WebMvcConfigurer {
   /**
    * 把本地图片变成网络图片
    * */

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /**
         * 访问路径：http://localhost:8086/image/2022001.png
         * "/image/**" 为前端URL访问路径
         * "file:" + bmpPath 是本地磁盘映射
         */
        registry.addResourceHandler("/image/**").addResourceLocations("file:///D:/upload/" );
    }
}
